<template>
	<view>
		<view style="position: relative;background-color:#fff;" :style="{width:$device.windowWidth() + 'px',height:$device.measure.windowHeight + 'px'}">
			<view style="margin: 0 20px 20px 20px;padding: 20px;">
				<text style="font-size: 20px;font-weight: bold;">掌聘人力招聘平台</text>
			</view>
			 
			<view style="position: absolute;top: 15%;left:20%;right:20%;height:50px;">
				<image :src="absUrl('/static/zp.png')"></image>
			</view>
			
			
				<view style="position: absolute;top: 55%;left:12%;right:12%;">
					<u-transition :show="showCard" mode="fade-left" :duration="2000">
					<view style="background-color: white;box-shadow: 0px 2px 16px 0px #66666644;border:solid 1px #eeeeee;border-radius: 10px;">
						<!-- 卡片头 -->
						<view style="border-bottom:solid 1px #eeeeee;padding:10px 10px;color: #7b7b7b;">来至企业微信</view>
						<!-- 卡片体 -->
						<view style="padding: 10px;">
							<view style="display: flex;justify-content: flex-start;align-items: center;">
								<u-avatar :src="absUrl('/static/avatar.jpg')" size="100"></u-avatar>
								<view style="margin:0 10px;">
									<view style="padding: 5px 0;font-size: 16px;">
										 <span>云谷少侠</span><span>&nbsp;</span><span style="color: limegreen">@麦微</span>
									</view>
									<view style="color: #7d7d7d;font-size: 13px;">
										管理员
									</view>
								</view>
							</view>
						</view>
						<!-- 卡片脚 -->
						<view style="border-top:solid 1px #eeeeee;padding: 10px;color: #7b7b7b;font-size: 13px;">邀请你加入代理</view>
					</view>
					</u-transition>
				</view>
			
			
			<view style="position: absolute;top: 25%;left:12%;right:12%;">

			</view>
			
			<view @click="showPopup = true" style="display: flex;justify-content: center;align-items:center;position: absolute;bottom: 10%;left:20%;right:20%;height:50px;background-color: limegreen;border-radius: 100px;">
				<text style="font-size: 15px;color: white;">微信一键加入代理</text>
			</view>
			
			<view @click="onLogin" style="display: flex;justify-content: center;align-items:center;position: absolute;bottom:47%;left:20%;right:20%;height:50px;background-color: limegreen;border-radius: 100px;">
				<text style="font-size: 15px;color: white;">登录</text>
			</view>
		</view>
	</view>
</template>

<script>
	
	export default {
		
		data() {
			return {
				showCard:false,
				showPopup:false,
				comfirmCallback:null,
			}
		},
		mounted() {
			// this.userStore.wxlogin();
		},
		methods:{
			async onLogin(){
				// uni.login({
				// 	provider:'weixin',
				// 	success(res) {
				// 		console.log(res)
				// 	}
				// })
				
				// 要求登录
				// 要求用户信息 //不验证
				// 要求身份信息 //至少验证手机号
				// 要求实名信息 //验证身份证和人脸识别
				
				
				let loginResult = await this.$refs.loginGurad.requireLogin()
				console.log(loginResult)
				
				if(!loginResult)
				{
					uni.showToast({
						icon:'error',
						title:'登录失败'
					})
					return
				}
				 
				await this.$refs.loginGurad.requireBaseInfo();
				
				uni.showToast({
					title:'登录成功',
					duration:500
				})
				
				let that = this
				setTimeout(()=>{
					that.showCard = true
				},1000)
			},
			onInputNickname(e){
				console.log(e)
			},
			onPhoneNumber(e){
				console.log(e)
				this.$http.post('/v3/api/hi',{
					iv:e.detail.iv,
					encryptedData:e.detail.encryptedData,
					code:e.detail.encryptedData,
				}).then((res)=>{
					 console.log(res)
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	
$u-button-u-button-height: 40px !default;

.custom {
	height: $u-button-u-button-height;
}
</style>
